package com.woniuxy.demo.service.Impl;

import com.woniuxy.demo.entity.Stu;
import com.woniuxy.demo.mapper.StuMapper;
import com.woniuxy.demo.service.SomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @author 佘赛飞
 * @create 2021 -10 -09 4:02 PM
 */
@Service
public class SomeServiceImpl implements SomeService {

    @Autowired
    StuMapper stuMapper;


    @Transactional
    @Override
    public void doSome() {
        Stu stu = new Stu(14,"xs",21,new Date());
//        if(true){
//            throw new RuntimeException("异常--doSome---Exception");
//        }
        stuMapper.inserStu(stu);
        Stu stu1 = new Stu(15,"k汪汪",24,new Date());
        stuMapper.inserStu(stu1);
    }
}
